package com.rgsx.pojo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 
 * @TableName order
 */
@TableName(value ="`order`")
@Data
@AllArgsConstructor
@NoArgsConstructor
//@JsonSerialize(using= ToStringSerializer.class)
public class Order implements Serializable {
    /**
     * 主键
     */
    @TableId(value = "id")
    private Long id;

    /**
     * 司机id
     */
    @TableField(value = "driver_id")
    private Long driverId;

    /**
     * 乘客id
     */
    @TableField(value = "passenger_id")
    private Long passengerId;

    /**
     * 乘客发起订单时间
     */
    @TableField(value = "begin_time")
    private Date beginTime;

    /**
     * 0乘客发起；1司机接单；2乘客上车；3订单结束；-1异常
     */
    @TableField(value = "state")
    private Integer state;

    /**
     * 结束时间
     */
    @TableField(value = "end_time")
    private Date endTime;

    /**
     * 上车位置Latitude
     */
    @TableField(value = "position_start_latitude")
    private String positionStartLatitude;

    /**
     * 下车位置Latitude
     */
    @TableField(value = "position_end_latitude")
    private String positionEndLatitude;

    /**
     * 上车位置Longitude
     */
    @TableField(value = "position_start_longitude")
    private String positionStartLongitude;

    /**
     * 下车位置Longitude
     */
    @TableField(value = "position_end_longitude")
    private String positionEndLongitude;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Order other = (Order) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getDriverId() == null ? other.getDriverId() == null : this.getDriverId().equals(other.getDriverId()))
            && (this.getPassengerId() == null ? other.getPassengerId() == null : this.getPassengerId().equals(other.getPassengerId()))
            && (this.getBeginTime() == null ? other.getBeginTime() == null : this.getBeginTime().equals(other.getBeginTime()))
            && (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()))
            && (this.getEndTime() == null ? other.getEndTime() == null : this.getEndTime().equals(other.getEndTime()))
            && (this.getPositionStartLatitude() == null ? other.getPositionStartLatitude() == null : this.getPositionStartLatitude().equals(other.getPositionStartLatitude()))
            && (this.getPositionEndLatitude() == null ? other.getPositionEndLatitude() == null : this.getPositionEndLatitude().equals(other.getPositionEndLatitude()))
            && (this.getPositionStartLongitude() == null ? other.getPositionStartLongitude() == null : this.getPositionStartLongitude().equals(other.getPositionStartLongitude()))
            && (this.getPositionEndLongitude() == null ? other.getPositionEndLongitude() == null : this.getPositionEndLongitude().equals(other.getPositionEndLongitude()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getDriverId() == null) ? 0 : getDriverId().hashCode());
        result = prime * result + ((getPassengerId() == null) ? 0 : getPassengerId().hashCode());
        result = prime * result + ((getBeginTime() == null) ? 0 : getBeginTime().hashCode());
        result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
        result = prime * result + ((getEndTime() == null) ? 0 : getEndTime().hashCode());
        result = prime * result + ((getPositionStartLatitude() == null) ? 0 : getPositionStartLatitude().hashCode());
        result = prime * result + ((getPositionEndLatitude() == null) ? 0 : getPositionEndLatitude().hashCode());
        result = prime * result + ((getPositionStartLongitude() == null) ? 0 : getPositionStartLongitude().hashCode());
        result = prime * result + ((getPositionEndLongitude() == null) ? 0 : getPositionEndLongitude().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", driverId=").append(driverId);
        sb.append(", passengerId=").append(passengerId);
        sb.append(", beginTime=").append(beginTime);
        sb.append(", state=").append(state);
        sb.append(", endTime=").append(endTime);
        sb.append(", positionStartLatitude=").append(positionStartLatitude);
        sb.append(", positionEndLatitude=").append(positionEndLatitude);
        sb.append(", positionStartLongitude=").append(positionStartLongitude);
        sb.append(", positionEndLongitude=").append(positionEndLongitude);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}